#include <vector>
using namespace std;
class Solution
{
public:
    // 找第一个比他大的数
    int searchInsert(vector<int> &nums, int target)
    {
        int left = 0, right = nums.size(), mid = 0;
        while (left < right)
        {
            mid = (left + right) >> 1;
            if (nums[mid] < target)
                left = mid + 1;
            else if (nums[mid] > target)
                right = mid;
            else
                return mid;
        }
        return left;
    }
};